<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.Map"%>
<%@ page import="util.DBUtils"%>
<%@ page import="java.util.List"%>
<%@ page import="util.TreeUtils2"%>
<%@ page import="java.sql.Connection"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%
Connection c = DBUtils.getConnction("jdbc/oracle");
String sql = "SELECT XH, CDMC, FCDXH FROM t_admin_rms_cd WHERE fcdxh IS NOT NULL";
List<Map<String, Object>> list = DBUtils.executeQuery(c, sql);
Map<String, List<Map<String, Object>>> maps = TreeUtils2.group(list.toArray(new Map[list.size()]), "FCDXH", String.class);
List<Map<String, Object>> root = maps.get("ROOT");
TreeUtils2.build(root, maps, "XH", String.class);
String tree = TreeUtils2.output(root, 0, "list", new util.TreeUtils2.IHandler() {
    public String handle(java.util.Map<String,Object> map) {
        String desc = (String) map.get("CDMC");
        Object o = map.get("list");
        String tree_class = "";
        if (null != o) {
            tree_class = "tree-folder";
        } else {
            tree_class = "tree-file";
        }
        String s = String.format("<input type=\"radio\" name=\"radio\" value=\"\" /><a href=\"#none\" class=\"%1$s\">" + desc + "</a>", tree_class);
        return s;
    }
});
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <title>Standard.jsp</title>
        <meta http-equiv="pragma" content="no-cache" />
        <meta http-equiv="cache-control" content="no-cache" />
        <meta http-equiv="expires" content="0" />
    </head>

<style>
<!--
/* margin: 0; 只对IE67 padding: 0; 对IE8及其它浏览器 */
ul {margin-left: 0; padding-left: 24px;}
body {font-size: 12px;}
a:visited {color: black;}
li {list-style: none;}
-->
</style>

<script type="text/javascript">
<!--
 
//-->
</script>

    <body>

<%=tree%>
        
    </body>
<script type="text/javascript">
<!--

//-->
</script>
</html>
